
import { Component, OnInit, Injector, TemplateRef, ViewChild, Input } from '@angular/core';
import { HttpService } from "../../../core/service/http.service";
import { NgZorroPageBaseComponent } from '../../../core/ng-zorro-page-base-component/ng-zorro-page-base-component.component';
import { HttpClient } from "@angular/common/http";
import { Router, NavigationExtras, ActivatedRoute, Params } from "@angular/router";
import {
  AndOr, Compare, ExpressionPair, PagedResultDto, PagerSearchInput, ElementViewType, BaseComponentConfig,
  SystemFormControl, FieldType, ElementShowType, CustomNavigation, ClassInfoOutput, NavigatType, ArSystemFormControl, ClassSchool
} from "../../..";
import { NzMessageService, NzModalService } from 'ng-zorro-antd';
import {
  FormBuilder, FormGroup, FormsModule, ReactiveFormsModule, Validators,
  FormControl
} from "@angular/forms";


@Component({
  selector: 'app-stuent-trai',
  templateUrl: './stuent-trai.component.html',
  styleUrls: ['./stuent-trai.component.scss']
})
export class StuentTraiComponent extends NgZorroPageBaseComponent implements OnInit {
  cityData;
  provinceData;
  selectedProvince;
  selectedCity;
  schoolName;
  collegelName;
  manalName;
  resultxy;
  resultxymana;
  listEntitiesdata;
  aclear;
  classmana;
  deleshty = {};
  deleshno = {};
  disabledButton = true;
  displayData: Array<{ name: string; age: number; address: string; checked: boolean }> = [];
  dataSet = [];
  checkedNumber = 0;
  operating = false;
  smisVisible = false;
  classname;
  editorContent;
  studentstatus: false; // 是否有申请
  isVisiblety = false;
  isVisiblej = false;
  namety;
  nameno;
  classid;
  allstudentdata;

  // className;
  ngOnInit() {
    this.IniObserver.subscribe(sb => {
      this.getEntityList();
    });
    this.activatedRoute.queryParams.subscribe(
      data => this.classid = (data['classId']));

  }
  constructor(
    injecter: Injector,
    public http1: HttpService,
    private modalService: NzModalService,
    public http: HttpClient,
    public message: NzMessageService,
    private activatedRoute: ActivatedRoute,

  ) {
    super(injecter,
      new BaseComponentConfig(
        "TeacherInfo/GetStudentRequest",
        "",
        "",
        "",
        "",
        "id",
        "",
        "",
        [],
        "",
        { Edit: false, Dell: false },
      ));
      // console.log(this.listEntities.entities);

  }


  handleCancel() {
    this.isVisiblety = false;
    this.isVisiblej = false;
  }
  async handleOkty(type: string) {
    this.isVisiblety = false;
    await this.http1.post<any>('TeacherInfo/ExaminationStduent', this.deleshty).then(e => {

    });
    this.message.create(type, `添加成功`);
    this.getEntityList();
  }

  async handleOkj(type: string) {
    this.isVisiblety = false;
    await this.http1.post<any>('TeacherInfo/ExaminationStduent', this.deleshno).then(e => {

    });
    this.message.create(type, `已拒绝`);
    this.getEntityList();
  }
  studentpass(id, name, classid, userid) {
    this.namety = name;
    this.deleshty = { "studentId": userid, "classInfoId": classid, "applyType": 0 };
    this.isVisiblety = true;
  }
  studentno(id, name, classid, userid) {
    this.nameno = name;
    this.deleshno = { "studentId": userid, "classInfoId": classid, "applyType": 0 };
    this.isVisiblej = true;
  }
}

